package com.kaibes.module.logger;

import java.math.BigInteger;
import java.time.LocalDateTime;
import java.util.Map;

import com.fasterxml.jackson.databind.JsonNode;
import com.kaibes.core.base.annotation.Description;

import lombok.Data;

/**
 * @author yolinfeng
 * 
CREATE TABLE `api_log` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL DEFAULT '',
  `uri` varchar(255) NOT NULL DEFAULT '',
  `method` varchar(255) NOT NULL DEFAULT '',
  `status` smallint DEFAULT NULL,
  `request_headers` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `request_body` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci,
  `response_headers` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `response_body` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci,
  `user_id` bigint DEFAULT NULL,
  `request_time` timestamp NULL DEFAULT NULL,
  `response_time` timestamp NULL DEFAULT NULL,
  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
 */
@Data
public class ApiLog {

    @Description("日志ID")
    private BigInteger id;
    @Description("服务名称")
	private String name;
    @Description("请求URL")
	private String uri;
    @Description("请求方法")
	private String method;
    @Description("请求头")
	private Map<String,String> requestHeaders;
    @Description("请求数据")
	private JsonNode requestBody;
    @Description("状态码")
	private Integer status;
	@Description("回复头")
	private Map<String,String> responseHeaders;
	@Description("回复数据")
	private JsonNode responseBody;
	@Description("用户ID")
	private Integer userId;
	@Description("请求时间")
    private LocalDateTime requestTime;
	@Description("回复时间")
    private LocalDateTime responseTime;
    @Description("创建时间")
    private LocalDateTime createTime;
}
